import request from '@/utils/request';

// 个人所得税服务
const personalIncomeTaxService = {
    // 个人所得税查询
    async queryPersonalIncomeTax(params) {
        return request('/api/finance/salary/v1/setting/tax/list', {
            method: 'GET',
            params
        });
    },

    // 个税预扣率待生效列表查询 -> 陈炎彬
    async queryPersonalIncomeTaxEffect(params) {
        return request('/api/finance/salary/v1/setting/tax/list/effect', {
            method: 'GET',
            params
        });
    },

    // 个税预扣率--审批详情
    async queryTaxApproveInfo(params) {
        return request(`/api/finance/salary/v1/setting/tax/approve/detail/${params.taxRateId}`, {
            method: 'GET',
            data: params
        });
    },

    // 个税预扣率--重置 -> 陈炎彬
    async resetPersonalIncomeTax(params) {
        return request(`/api/finance/salary/v1/setting/tax/reset/${params.taxRateId}`, {
            method: 'POST'
        });
    },

    // 个税预扣率--新增级数 -> 陈炎彬
    async addLevel(params) {
        return request('/api/finance/salary/v1/setting/tax', {
            method: 'POST',
            data: params
        });
    },

    // 个税预扣率--修改 -> 陈炎彬
    async updateLevel(params) {
        return request('/api/finance/salary/v1/setting/tax', {
            method: 'PUT',
            data: params
        });
    },

    async deleteLevel(params) {
        return request(`/api/finance/salary/v1/setting/tax/${params.taxRateId}/${params.taxDetailId}`, {
            method: 'DELETE'
        });
    },

    // 个人所得税操作日志-操作字段 -> 林志胜
    async queryOperateContent() {
        return request('/api/finance/salary/v1/log/taxSetLog/operateContent', {
            method: 'GET'
        });
    },

    // 个税预扣率-计算器 -> 陈炎彬
    async calculate(params) {
        return request('/api/finance/salary/v1/setting/tax/calculator', {
            method: 'POST',
            data: params
        });
    },

    // 个税预扣率--个税配置校验(已经配置的个税金额需要连续) -> 陈炎彬
    async queryTaxLevelContinuity(params) {
        return request(`/api/finance/salary/v1/setting/tax/check/${params.taxRateId}`, {
            method: 'GET'
        });
    }
};

export default personalIncomeTaxService;
